<!DOCTYPE html>
<html>
<head th:replace="layouts::header">
</head>

<body>

<nav th:replace="layouts::navbar"></nav>
<div>
    <h3>&nbsp</h3>
</div>
<div class="distance">
   <h3>书籍目录</h3>
    <hr>
    <a th:href="@{/books/new}">新增书籍</a>
    <br>
    <table>
        <thead>
        <tr>
            <th>书名</th>
            <th>类型</th>
            <th>作者</th>
            <th>动作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="aBook : ${books}">
            <td th:text="${aBook.name}"></td>
            <td th:text="${aBook.numberId}"></td>
            <td th:text="${aBook.author}"></td>
            <td>
                <a th:href="@{/books/update(id=${aBook.bookId})}" class="btn btn-info btn-sm">更换</a>

                <a th:href="@{/books/delete(id=${aBook.bookId})}"
                   class="btn btn-info btn-sm"
                   onclick="if (!(confirm('你确定归还这本书吗'))) return false"
                >还书</a>

            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>